package com.yamanyar.weebill.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.yamanyar.weebill.dao.AttachmentDAO;
import com.yamanyar.weebill.domain.Attachment;
import com.yamanyar.weebill.service.AttachmentService;
/**
 * Implementation of <code>AttachmentService</code> interface.
 * Created in Jun 28, 2008.
 * @see AttachmentService
 * @author Kaan Yamanyar
 */
@Service
public class AttachmentServiceImpl implements AttachmentService {

	private AttachmentDAO attachmentDAO;

	@Autowired
	public AttachmentServiceImpl(AttachmentDAO attachmentDAO) {
		this.attachmentDAO = attachmentDAO;
	}

	public void createNew(Attachment attachment) {
		attachmentDAO.persist(attachment);
	}

	public List<Attachment> findAll() {
		return attachmentDAO.loadAll();
	}

	public List<Attachment> findByName(String name) {
		return attachmentDAO.findByName(name);
	}

}
